import {IconType} from "@/components/IconFont/type";

export default class Buff {
  private pumpkinScore_: boolean = false;
  private hydrangeaAction_: boolean = false;
  private saffronAction_: boolean = false;
  private fruitNumScore_: number = 0;
  private fruitTypeScore_: boolean = false;
  private appleGoods_: number = 0;
  private flowerPeachGoods_: number = 0;
  private blackberryGoods_: number = 0;
  private toolPeachGoods_: number = 0;
  private bonusActionShovel_: boolean = false;
  private barrowGoods_: number = 0;
  private farmCompost_: number = 0;

  extraScoreForPumpkin() {
    this.pumpkinScore_ = true;
    console.log(`南瓜刻刀已激活`);
  }

  extraCompostFromHydrangea() {
    this.hydrangeaAction_ = true;
    console.log(`干草叉已激活`);
  }

  extraBeehiveActionFromSaffron() {
    this.saffronAction_ = true;
    console.log(`蜂巢套装已激活`);
  }

  extraScoreForFruitNum(fruits: number) {
    this.fruitNumScore_ = fruits;
    console.log(`${this.tulipScore}分/个水果`);
  }

  extraScoreForFruitType() {
    this.fruitTypeScore_ = true;
    console.log(`果盘已激活`);
  }

  extraGoodsForApple(apple: number) {
    this.appleGoods_ += apple;
    console.log(`${this.appleGoods}货物/苹果`);
  }

  extraGoodsForPeach(goods: number, source: IconType) {
    if (source === IconType.FLOWER) this.flowerPeachGoods_ += goods;
    if (source === IconType.TOOL) this.toolPeachGoods_ += goods;
    console.log(`${this.peachGoods}货物/桃子`);
  }

  extraGoodsForBlackberry(blackberry: number) {
    this.blackberryGoods_ += blackberry;
    console.log(`${this.glassGoods}货物/黑莓`);
  }

  extraBonusFromCompost() {
    this.bonusActionShovel_ = true;
    console.log(`铲子已激活`);
  }

  extraGoodsForTool(toolAction: number) {
    this.barrowGoods_ += toolAction;
    console.log(`${this.barrowGoods}货物/工具棚`);
  }

  rangeCompostForReclaim(compost: number) {
    this.farmCompost_ += compost;
    console.log(`扩大农垦${this.irisCompost}选择范围`);
  }

  get appleGoods() {return this.appleGoods_;}

  get peachGoods() {return this.tulipGoods + this.toolPeachGoods_;}

  get blackberryGoods() {return this.glassGoods;}

  get tulipScore() {return this.fruitNumScore_;}

  get tulipGoods() {return this.flowerPeachGoods_;}

  get glassGoods() {return this.blackberryGoods_;}

  get pieGoods() {return this.toolPeachGoods_ + this.appleGoods;}

  get shovelBuff() {return this.bonusActionShovel_}

  get saladBuff() {return this.fruitTypeScore_;}

  get suitBuff() {return this.saffronAction_;}

  get forkBuff() {return this.hydrangeaAction_;}

  get barrowGoods() {return this.barrowGoods_;}

  get pumpkinBuff() {return this.pumpkinScore_;}

  get irisCompost() {return this.farmCompost_;}

  // 单例模式
  private constructor() {
  }

  private static instance: Buff | null = null;

  public static getInstance(): Buff {
    if (this.instance === null) {
      this.instance = new Buff();
    }
    return this.instance
  }
}
